package io;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class ReadString {
    public static void main(String[] args) throws IOException {
        File file = new File("./src/main/java/io/ReadString.java");
        FileInputStream fis = new FileInputStream(file);
        long len = file.length();//获取字节长度
        byte[] data = new byte[(int)len];
        fis.read(data); //将文件所有字节读入data数组中

        String line = new String(data, StandardCharsets.UTF_8);
        System.out.println(line);
        fis.close();
    }
}
